package com.jl.jlapp.utils;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.FontMetricsInt;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.AppCompatTextView;
import android.text.TextUtils;
import android.util.AttributeSet;

import com.jl.jlapp.R;
import com.jl.jlapp.R.styleable;

public class SuperTextView
  extends AppCompatTextView
{
  private float ratio;
  private Rect rcSubTitle;
  private Rect rcTitle;
  private String subTitle;
  private int subTitleColor;
  private Paint subTitlePaint;
  private String title = getText().toString();
  private Paint titlePaint;
  
  public SuperTextView(Context paramContext)
  {
    this(paramContext, null);
  }
  
  public SuperTextView(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, 0);
  }
  
  public SuperTextView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
//    paramAttributeSet = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.SuperTextView);
//    paramInt = 0;
//    int i = paramAttributeSet.getIndexCount();
//    if (paramInt < i)
//    {
//      int j = paramAttributeSet.getIndex(paramInt);
//      switch (j)
//      {
//      default:
//        this.subTitle = "";
//      }
//      for (;;)
//      {
//        paramInt += 1;
//        break;
//        this.subTitle = paramAttributeSet.getString(j);
//        continue;
//        this.subTitleColor = paramAttributeSet.getColor(j, ContextCompatgetColor(paramContext, R.color.dark_gray));
//        continue;
//        this.ratio = paramAttributeSet.getFraction(j, 1, 1, 0.88F);
//      }
//    }
//    paramAttributeSet.recycle();
//    if (TextUtils.isEmpty(this.subTitle)) {
//      this.subTitle = "";
//    }
//    this.titlePaint = getPaint();
//    this.titlePaint.setColor(getCurrentTextColor());
//    this.subTitlePaint = new Paint(this.titlePaint);
//    float f = getTextSize();
//    this.subTitlePaint.setTextSize(this.ratio * f);
//    this.subTitlePaint.setColor(this.subTitleColor);
//    this.subTitlePaint.setAntiAlias(true);
//    this.subTitlePaint.setTextAlign(Align.CENTER);
//    this.rcTitle = new Rect();
//    this.rcSubTitle = new Rect();
  }
  
  public String getSubTitle()
  {
    return this.subTitle;
  }
  
  protected void onDraw(Canvas paramCanvas)
  {
    if (TextUtils.isEmpty(this.subTitle)) {
      super.onDraw(paramCanvas);
    }
    int i;
//    Object localObject;
//    do
//    {
//      return;
//      this.titlePaint.getTextBounds(this.title, 0, this.title.length(), this.rcTitle);
//      this.subTitlePaint.getTextBounds(this.subTitle, 0, this.subTitle.length(), this.rcSubTitle);
//      i = getTotalPaddingLeft();
//      k = getTotalPaddingTop();
//      int n = getTotalPaddingRight();
//      m = getTotalPaddingBottom();
//      j = getMeasuredWidth() - i - n;
//      m = getMeasuredHeight() - k - m;
//      int i4 = Math.max(this.rcTitle.height(), this.rcSubTitle.height());
//      localObject = this.titlePaint.getFontMetricsInt();
//      FontMetricsInt localFontMetricsInt = this.subTitlePaint.getFontMetricsInt();
//      int i1 = (m - i4) / 2;
//      int i2 = (i4 - ((FontMetricsInt)localObject).bottom - ((FontMetricsInt)localObject).top) / 2;
//      int i3 = (m - i4) / 2;
//      i4 = (i4 - localFontMetricsInt.bottom - localFontMetricsInt.top) / 2;
//      int i5 = getMeasuredWidth();
//      int i6 = this.rcSubTitle.width() / 2;
//      paramCanvas.drawText(this.title, i, i1 + k + i2, this.titlePaint);
//      paramCanvas.drawText(this.subTitle, i5 - n - i6, i3 + k + i4, this.subTitlePaint);
//      localObject = getCompoundDrawables();
//      if (localObject[0] != null)
//      {
//        n = localObject[0].getIntrinsicWidth();
//        i1 = localObject[0].getIntrinsicHeight();
//        i2 = getPaddingLeft();
//        i3 = k + (m - i1) / 2;
//        localObject[0].setBounds(i2, i3, i2 + n, i3 + i1);
//        localObject[0].draw(paramCanvas);
//      }
//      if (localObject[1] != null)
//      {
//        n = localObject[1].getIntrinsicWidth();
//        i1 = localObject[1].getIntrinsicHeight();
//        i2 = i + (j - n) / 2;
//        i3 = getPaddingTop();
//        localObject[1].setBounds(i2, i3, i2 + n, i3 + i1);
//        localObject[1].draw(paramCanvas);
//      }
//      if (localObject[2] != null)
//      {
//        n = localObject[2].getIntrinsicWidth();
//        i1 = localObject[2].getIntrinsicHeight();
//        i2 = getMeasuredWidth() - getPaddingRight() - n;
//        k += (m - i1) / 2;
//        localObject[2].setBounds(i2, k, i2 + n, k + i1);
//        localObject[2].draw(paramCanvas);
//      }
//    } while (localObject[3] == null);
//    int k = localObject[3].getIntrinsicWidth();
//    int m = localObject[3].getIntrinsicHeight();
//    i += (j - k) / 2;
//    int j = getMeasuredHeight() - getPaddingBottom() - m;
//    localObject[3].setBounds(i, j, i + k, j + m);
//    localObject[3].draw(paramCanvas);
  }
  
  public void setSubTitle(String paramString)
  {
    this.subTitle = paramString;
    invalidate();
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/utils/SuperTextView.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */